Last active
November 6, 2019 20:39
-
-
Save jacobsologub/23853fd06c53c3a506c3bbe76c77dabd to your computer and use it in GitHub Desktop.
Revisions
-
jacobsologub revised this gist
Nov 6, 2019 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,8 @@ // Created by Jacob Sologub on 29 Oct 2019 9:22:41pm // Copyright © 2019 Jacob Sologub. All rights reserved. import { Asset, Time, TimeRange, Clip, Vector, coreimage } from 'hypno'; import { Image, Filter } from 'hypno/coreimage'; Time.timescale = 30; let emptyClip = new Clip (new Time (30 * 3)); -
jacobsologub created this gist
Oct 30, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ // // crossfade-images.js // libhypno // // Created by Jacob Sologub on 29 Oct 2019 9:22:41pm // Copyright © 2019 Jacob Sologub. All rights reserved. import { Asset, Time, TimeRange, Clip, Vector, Image, Filter, coreimage } from 'hypno'; Time.timescale = 30; let emptyClip = new Clip (new Time (30 * 3)); const TrackIDs = { Image: "image" }; const track = composition.track (TrackIDs.Image); track.add (emptyClip); const image1 = new Image ("./T0YRgsZ11jr6.jpg"); const image2 = new Image ("./T0YRgsZ11jr6-swapped.png"); composition.renderSize = image1.size; composition.render = function (context) { const instruction = context.instruction; const instructionProgress = (instruction.time.value / instruction.timeRange.duration.value); const colorMatrixFilter = new Filter (coreimage.CIColorMatrix, { inputAVector: new Vector (0.0, 0.0, 0.0, instructionProgress), inputImage: image2 }); const sourceOverFilter = new Filter (coreimage.CISourceOverCompositing); sourceOverFilter.set ({ inputBackgroundImage: image1, inputImage: colorMatrixFilter.apply() }); context.setFrame (TrackIDs.Image, sourceOverFilter.apply()); };