Standard Library (Full Documentation)

#buildTimeline

fps

  • the frames per second of your timeline

  • type: integer

  • default: 30

resolution

  • the horizontal and vertical size of the video surface in pixels

  • type: Vector(integer, integer)

  • default: Vector(960, 1280)

audio

  • the music or other audio element to be played during your video clips, absolute or local path

  • type: Asset(string)

  • default: none

    • this media will span the entire timeline created during buildTimeline automatically

    • if the media is too short to span the full timeline, it will loop

clips

  • an array of objects describing the media, timing and effects that create your timeline

  • type: [Object]

  • default: none

  • keys

    • name

      • the string name of this clip

      • type: string

      • default: none

        • used to allow other utility functions in the render to reference this clip easily

        • eg: #isActive("myClip") -> bool

    • track

      • the track on which this clip should be placed

      • type: Track | string

      • default: "track0"

        • you may pass in a previously declared Track as a variable or a string

        • if you pass in a string name and that track doesn't already exist, it will be created for you

    • asset

      • which asset to use as the media for this clip

      • type: Asset | Image

      • default: argv[1][0]

        • if you do not set this key, it will use the default camera (the first camera in a multi-camera or multi-capture situation, or the first media sent in during a HYPNO Cloud request)

        • if you pass in an Image, it will placed as a still that spans the duration of the clip

    • cam

      • which camera to use in a multi-input camera situation

      • type: integer

      • default: 0

        • if your script captures 3 media items, or you send 3 media items to HYPNO Cloud, you could make clips using cam 0, 1 or 2

    • start

      • equivalent of marking an in point in a non-linear editor, this sets your offset (in frames) inside the media item

      • type: integer

      • default: 0

        • if you would use 30 as your value, for example, you would "slip" your media item 30 frames toward tail, skipping the first second of available footage for this clip

    • duration

      • length (in frames) of this clip on the timeline

      • type: integer

      • default: 0

    • speed

      • playback rate for this clip

      • type: float

      • default: 1.0

        • if you were to use 2.5 as your value, your clip would play back at 2.5x speed to normal

    • insert

      • position (in frames) to insert this clip in the timeline

      • type: integer

      • default: none

        • leaving this value off assumes this clip immediately follows the previous clip on the same track

        • you can't insert a clip earlier than the previous clip ended, otherwise you could overlap

    • blend

      • set the blend mode for this clip. these can be accessed under the blend namespace or with the equivalent string

      • type: string

      • default: none

        • usage: hypno.blend.componentAdd | "componentAdd"

        • options

          • componentAdd

          • componentMultiply

          • componentMin

          • componentMax

          • clear

          • source

          • destination

          • sourceOver

          • destinationOver

          • sourceIn

          • destinationIn

          • sourceOut

          • destinationOut

          • sourceAtop

          • destinationAtop

          • exclusiveOr

          • multiply

          • screen

          • overlay

          • darken

          • lighten

          • colorDodge

          • colorBurn

          • hardLight

          • softLight

          • difference

          • exclusion

          • hue

          • saturation

          • color

          • luminosity

          • subtract

          • divide

          • linearBurn

          • linearDodge

          • vividLight

          • linearLight

          • pinLight

          • hardMix

          • darkerColor

          • lighterColor

    • transform

      • affect the translation, scale and rotation of the clip's asset

      • type: Object | string

      • default: none

        • there are built-in options for simple fit/fill algorithms, as well as the ability to rotate in common increments. these can be accessed under the transform namespace or with the equivalent string

        • usage: hypno.transform.fit | "fit"

        • options

          • fit -> fit within dimensions fill -> fully cover the dimensions fitCW -> fit and rotate clockwise fillCW -> fill and rotate clockwise fitCCW -> fit and rotate counter-clockwise fillCCW -> fill and rotate counter-clockwise fitFlip -> fit and rotate 180 degrees fillFlip -> fill and rotate 180 degrees

        • there is a more advanced option of specifying your values manually for the transform, in which case you pass in an object with these keys

          • translate

            • type: Vector(float, float)

            • default: Vector(0.0, 0.0)

          • scale

            • type: Vector(float, float)

            • default: Vector(1.0, 1.0)

          • rotate

            • type: float

            • default: 0.0

    • alpha

      • uses a shader to account for h265 alpha channels

      • type: boolean

      • default: false

        • if you're using an h265 video with alpha channel, set this to true to avoid visual artifacts

    • filter

      • an array of CIFilters and Kernels that are applied in order on this clip

      • type: [Filter | Kernel]

      • default: none

        • Filter

          • create and use any CIFilter here and leave off the inputImage property, as it will be implied to use the current frame of this clip

        • Kernel

          • create and use any Kernel here, and use the parameter signature of (sampler, float)

            • the first parameter will be the current frame of this clip

            • the second parameter will be a normalized 0-1 time value of this clip

ranges

  • ranges are used like the clips array, but it's just a way to get a normalized 0-1 time value for an arbitrary range that doesn't match a clip. this could be useful for timing a fade-in across several clips or making just one small segment of a clip look different

  • type: [Object]

  • default: none

  • keys

    • name

      • the string name of this region, used the same as a name on a clip

      • type: string

      • default: none

        • used to allow other utility functions in the render to reference this region easily

        • eg: #isActive("myRegion") -> bool

    • duration

      • length (in frames) of this region on the timeline

      • type: integer

      • default: 0

    • insert

      • position (in frames) to insert this region in the timeline

      • type: integer

      • default: none

#onRender

  • a function that runs on every drawn frame allowing you to animate or change the effects for each frame

  • return parameters: context

  • example:

hypno.onRender(function(context) {
    if (hypno.isActive("myClip")) {
        let progress = hypno.progress("myClip")
        let progressAlt = hypno.progress("myClip).ease(hypno.easing.linear)
    }
})

#isActive

  • a method to query if a clip or region is active during the current frame

  • parameters: string

  • return parameters: boolean

#progress

  • a method to get a normalized 0-1 time for the progress of the clip or region on the current frame

  • parameters: string

  • return parameters: float

  • can be chained with #ease to ease the return value

  • #ease

    • accessed from the easing namespace

    • type: hypno.easing function

    • default: hypno.easing.linear

      • options

        • linear

        • inQuad

        • outQuad

        • inOutQuad

        • inCubic

        • outCubic

        • inOutCubic

        • inQuart

        • outQuart

        • inOutQuart

        • inQuint

        • outQuint

        • inOutQuint

Last updated

Was this helpful?