Cavalry
  • Welcome
  • Getting Started
    • Requirements
    • Installation
    • Sign In
      • Proxy Server
    • Quick Start
    • Example Files
    • Key Concepts
      • Nodes
      • Connections
      • Context
  • User Interface
    • Menus
      • File menu
      • Edit menu
      • View menu
      • Composition menu
      • Create menu
      • Animation menu
      • Shape menu
      • Tool menu
        • Select tool
        • Edit Shape tool
        • Pen tool
        • Pencil tool
        • Line tool
        • Text tool
        • Rectangle tool
        • Ellipse tool
        • Polygon tool
        • Star tool
        • Arc tool
        • Super Ellipse tool
        • Cog tool
        • Arrow tool
        • Capsule tool
      • Window menu
        • Align Window
        • Animation Utilities
        • Assets Window
          • Google Sheets Asset
          • Image Sequences
          • Project Settings
        • Attribute Editor
          • Control Rows
            • Controls Rows - Types
            • Control Rows - Interaction
        • Color window
          • Palettes
        • Control Center
        • Quick Add window
        • Flow Graph
        • Glyph Browser
        • Playback Controls
        • Preferences
        • Render Manager
          • Lottie Export
          • Dynamic Rendering
          • Render Tokens
        • Scene Window
          • Scene Tree
            • Composition Settings
          • Time Editor
          • Graph Editor
          • Keyframe Layers
        • Shelf
        • Tags
        • Toolbar
        • Viewport
          • Rulers
      • Help menu
    • Widgets
      • Gradient
      • Graph Attribute
    • General
      • Aliasing
      • Blend Modes
      • Distribution Types
        • Array Distribution
        • Circle Distribution
        • Fibonacci Distribution
        • Grid Distribution
        • Linear Distribution
        • Mask Distribution
        • Math Distribution
        • Path Distribution
        • Point Distribution
        • Random Distribution
        • Rose Distribution
        • Shape Edges Distribution
        • Shape Points Distribution
        • Shuffle Distribution
        • Sub-Mesh Distribution
        • Voxelize Distribution
      • Color Management
      • Motion Blur
      • Vector artwork support
  • Nodes
    • Shapes
      • Common Attributes (Shapes)
      • Background Shape
      • Basic Line
        • Bézier
        • Line
        • Spiral
      • Basic Shape
        • Arc
        • Arrow
        • Capsule
        • Cogwheel
        • Ellipse
        • Polygon
        • Rectangle
        • Ring
        • Star
        • Super Ellipse
      • Cel Animation Shape
      • Composition
      • Connect Shape
      • Convex Hull
      • Custom Shape
      • Duplicator
      • Editable Shape
      • Footage Shape
      • Group
      • Image to Shapes
      • Layout Shape
        • Grid Layout
        • Horizontal Layout
        • Vertical Layout
      • Outline
      • Points to Curve
      • Quad Tree Shape
      • Rectangle Pattern
      • SVG
      • Spacer
      • Sub-Mesh Bounding Box
      • Text Shape
      • Trails
    • Behaviours
      • Common Attributes (Behaviours)
      • 3D Matrix
      • Add Divisions
      • Align
      • Alpha Material Override
      • Apply Distribution
      • Apply Layout
      • Behaviour Mixer
      • Bevel
      • Blend Shape
      • Blend Sub-Mesh Positions
      • Boolean
      • Clean Up
      • Color Blend
      • Color Material Override
      • Curve to Lines
      • Distance
      • Fill Rule
      • Flare
      • Flatten Shape Layers
      • Frame
      • Get Vector
      • HSV Material Overide
      • Is Within
      • Look At
      • Manipulator
      • Material Sampler
      • Modulate
      • Morph
      • Noise
      • Number Range
      • Number Range to Color
      • Oscillator
      • Path Offset
      • Pathfinder
      • Pinch
      • Position Blend
      • Push Along Vector
      • Random
      • Resample Path
      • Round
      • Rubber Hose Limb
      • Simple Value Solver
      • Simple Value2 Solver
      • Skew
      • Sound
      • Split Path
      • Spring
      • Squetch
      • Stagger
      • Sub-Mesh
      • Subdivide
      • Swap Color Override
      • Value
      • Value 2
      • Value Blend
      • Value2 Blend
      • Visibility Sequence
      • Voxelize
    • Utilities
      • Animation Control
      • Apply Font Size
      • Array Manipulator
      • Asset Array
      • Bounding Box
      • Bounding Box Constraint
      • Color Array
      • Color Info
      • Composition Constraint
      • Component Constraint
      • Context Index
      • Falloff
      • Get Name
      • HSV Color
      • If Else
      • Index to Color
      • JS Math
      • Length Context
      • Local Time
      • Math
      • Math2
      • Math 3
      • Measure
      • Mesh Array
      • Null
      • Path Length
      • Regex
      • Rig Control
      • Sequence
      • Shader Array
      • Spreadsheet
      • Spreadsheet Lookup
      • String
      • String Array
      • String Generator
        • Formatted String Generator
        • Hash Generator
        • Hexadecimal Generator
        • Random Date Generator
        • Random Number Generator
        • Timecode Generator
        • Value Generator
      • String Length
      • String Manipulator
        • Change String Case Manipulator
        • Join String Manipulator
        • Replace String Manipulator
        • Regex String Manipulator
        • Resize String Manipulator
        • Shuffle String Manipulator
        • Sub-String Manipulator
        • Transition String Maniplulator
      • Transform Constraint
      • Typeface
      • Typeface Array
      • Value Array
      • Value 2 Array
      • Value 2 Array
      • Velocity Context
      • Velocity Magnitude Context
    • Effects
      • Blur
      • Color Shader
      • Drop Shadow
      • Fill
      • Gradient Shader
      • Image Shader
      • Invert
      • Levels
      • Linear Wipe
      • Mask Blur
      • Noise Shader
      • Radial Wipe
      • SkSL Shader
      • Shape to Shader
      • Tri Tone
      • Venetian Blinds
  • Tips
    • Shortcuts
  • Applications
    • Cavalry Player
    • Cavalry CLI
  • Technical Information
    • Licencing
    • Logs
    • Mathematical Expressions
    • Release Notes
      • 1.1.1 Release Notes
      • 1.1 Release Notes
      • 1.0.3 Release Notes
      • 1.0.2 Release Notes
      • 1.0.1 Release Notes
    • User Preferences
Powered by GitBook
On this page

Was this helpful?

  1. Nodes
  2. Behaviours

Modulate

Output sequences of numbers.

PreviousMaterial SamplerNextMorph

Last updated 5 years ago

Was this helpful?

+

Mode:

  • Remainder - create a sequence based on a Divisor value.

  • Pass /Fail - create a sequence based on whether the remainder is 0 (pass) or not (fail).

  • Custom Pattern - create your own pattern.

Divisor - setting a value of n will create a sequence of numbers from 0 > n-1. e.g. a value of 3 will create a sequence of 0,1,2,0,1,2,0... (see below).

Index Offset - offset the order of the pattern. e.g. if your pattern is 0, 1, 2, 0, 1, 2... an Index Offset of 1 will result in 1, 2, 0, 1, 2, 0...

Offset - offset the start value. e.g. if your pattern is 0, 1, 2, 0, 1, 2... an Offset of 2 will result in 2, 3, 4, 2, 3, 4...

Pass Value - when the remainder is 0, output this value.

Fail Value - when the remainder is not 0, output this value.

Custom Pattern - enter a pattern of values separated by commas.

Example usage Remainder:

  1. Create 3 (circle, rectangle, polygon).

  2. Select all 3 Shapes.

  3. Hold alt and click the icon.

  4. Set Count to x = 5, y = 5 on the Duplicator.

  5. Create a Modulate.

  6. Set Divisor to 3.

  7. Connect modulate.id > duplicator.shapeId.

With a Divisor of 3 Modulate is outputting values of 0, 1, 2, 0, 1, 2, 0... so your Duplicator outputs circle, rectangle, polygon, circle, rectangle, polygon, circle... (depending on the order they were added).

Example usage for Pass/ Fail:

  1. Select the Shape.

  2. Set the Distribution to Linear on the Duplicator.

  3. Set Count to 9 and Size to 900.

  4. Add a second index and set a different color.

  5. Connect colorArray.id > basicShape.FillColor.

  6. Create a Modulate Behaviour.

  7. Set Mode to Pass/ Fail.

  8. Set Divisor to 3.

  9. Connect modulate.id > colorArray.index.

The resulting sequence is 0,1,1,0,1,1,0... (see below for the math). If your Pass Value = 0 and Fail Value = 1 then that translates to pass, fail, fail, pass, fail, fail, pass... If the colors on your Color Array are red and green the resulting sequence of colors will then be red, green, green, red, green, green, red, green...

The Remainder and Pass/ Fail modes use Modular Math.

Here we're dividing a number using a Divisor of 3. Observe what happens to the remainder value as the number increments by one.

  • 0/3 = 0 remainder 0

  • 1/3 = 0 remainder 1

  • 2/3 = 0 remainder 2

  • 3/3 = 1 remainder 0

  • 4/3 = 1 remainder 1

  • 5/3 = 1 remainder 2

  • 6/3 = 2 remainder 0

  • ...

As you can see, the remainders start at 0 and increase by 1 each time, until the number reaches one less than the Divisor. After that, the sequence repeats. So, if you wanted to create the sequence 0,1,2,3,0,1,2,3,... you'd need a Divisor of 4.

Create a .

Hold alt and click the icon.

Create a .

Common Attributes
Basic Shapes
Duplicator
Shelf
Basic Shape
Duplicator
Shelf
Color Array