Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement new intensify command #2

Open
wants to merge 2 commits into
base: master
from
Open

Conversation

@zack
Copy link

zack commented Feb 8, 2020

  • Remove +Intensifies from effects
  • Add testing gifs

It doesn't work great for gifs that are faster than the 0.05s/frame. But someone can fix that in v2 with more math. 馃槄 It tries to create 0.05s frames, so if frame delays are longer than that it will split those frames into multiple frames, great! But if the frames are shorter than that, it will use the original frame length (so as not to slow down the original animation), but it doesn't do anything to slow down the resulting very fast jumping around. It would require splitting the frames up into smaller segments and setting multiple frames in a row to the same offset. Maybe something for another day!

Example 1 (transparent bg)

Before

ex1

After

ex1b

Example 2 (colorful bg)

Before

ex2

After

ex2b

Example 3 (more complex)

Before

ex3

After

ex3b

Example 4 (a gif with 0.03 frame delay)

Before

rofl

After

undefined1581203021953

@zack

This comment has been minimized.

Copy link
Author

zack commented Feb 8, 2020

Instead of using the offsets from the "original" intensifies command, I'm just using corners. LMK if you want me to add more offsets or to order them instead of randomize them.

Copy link
Owner

atwulf left a comment

this is awesome, thanks for making it work! i have some changes; biggest one would be to move this back into the effects command where +Intensify was originally, otherwise it's mostly nits.


let expanded_and_split_frames = UtilArray.flatmap(frames.map((frame, idx) => {
const expandedFrame = this.expandFrame(frame);
return this.splitFrame(expandedFrame, frame_delay);

This comment has been minimized.

Copy link
@atwulf

atwulf Feb 12, 2020

Owner

you should be able to do this in the effects command, without needing to create a separate command just for intensifying. Frame.transformFrames allows you to return an array of frames from the transformation callback

commands/intensify.js Show resolved Hide resolved
commands/intensify.js Show resolved Hide resolved
commands/intensify.js Show resolved Hide resolved
commands/intensify.js Show resolved Hide resolved

async render() {
const image = await ImageLoader.fromUrl(this.getUrl());
const frame_delay = 5;

This comment has been minimized.

Copy link
@atwulf

atwulf Feb 12, 2020

Owner

general style nits: please use camelCase rather than snake_case, remove semicolons, and access object properties using dot notation (image.frames rather than image['frames'])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can鈥檛 perform that action at this time.