Skip to content

Procedural animation effects for playlab goal objects#4786

Merged
islemaster merged 21 commits into
stagingfrom
pulse-item
Oct 29, 2015
Merged

Procedural animation effects for playlab goal objects#4786
islemaster merged 21 commits into
stagingfrom
pulse-item

Conversation

@islemaster

Copy link
Copy Markdown
Contributor

We wanted a way to 'pulse' or 'flash' goal objects to draw attention to them and help them stand out from the rest of the level. Here, I introduce an image effect system using SVG filters with three starter effects: "pulse", "glow" and "shine."

Note: For GIFs below I've manually added the effect to a hazard "item" sprite, since our circle placeholder "goal" sprites don't do the effects justice 😁. Also, GIF compression doesn't show some of these so well - they are much smoother when rendered.

Pulse
A brightness increase to pure white and back.
filter_pulse_preview

Glow
A white glow outline that appears and fades.
filter_glow_preview

Shine
A spotlight that sweeps across the object from top-left to lower-right.
filter_shine_preview

There are two major caveats to this new feature.

  1. The animations are currently implemented using SMIL SVG animation, which is unsupported in all versions of IE and deprecated in other browsers. Before we ship, we need to convert the animation of the filter properties to be driven by Javascript.
  2. SVG filters are unsupported in IE9. We're going to consider it a graceful degradation to just omit these extra visual effects for our IE9 users. Before we ship, we should add a feature check to the ImageFilter base class and turn its applyTo method into a no-op for IE9 users.

Otherwise, take these and run with it! Have fun!

Comment thread apps/src/studio/studio.js Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So easy to use!

@islemaster

Copy link
Copy Markdown
Contributor Author

cc @cpirich, and @caleybrock and @bcjordan in case this is useful in the tutorials you guys are working on.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems important. what happens if it's not a no-op in ie9?

@breville

Copy link
Copy Markdown
Member

This is really cool: nice code, and nice effects too. I'm concerned around the IE9 incompatibility for all effects and all-IE incompatibility for some of them. We've seen classrooms with a mixed range of devices, e.g. a bunch of portable Surfaces with IE but also a bunch of desktops running Chrome, and I'm worried about inconsistencies between what different students are seeing, let alone between what a teacher sees/demos and what the students see. It seems as though we could achieve a number of these effects with a simple spritesheet which would be functional everywhere, and not too burdensome for a content partner to produce.

So my inclination is to maybe hold off on committing this until we know we're going to use it in production. But it's also a great feature, so if somebody else finds a use for it now, that would be a vote in favour of getting it in production.

@islemaster

Copy link
Copy Markdown
Contributor Author

Sounds good; I'll hold onto this at least until I get the animation working in a way that is IE10+ compatible.

I feel like having a little library of these is so useful, at least for prototyping, that the graceful degradation cost is worth it. Sure, the effects are simple and a partner could/should easily bake them in, but I don't want to make them do that for every sprite when we can code it once and have it available for any image in playlab.

Besides, having a little framework for the filters system is so powerful - we could build up to things like the 'weathered text' effect here: http://www.smashingmagazine.com/2015/05/why-the-svg-filter-is-awesome/

Maybe the answer is we keep these around for prototyping (like the "scale" feature) but try to get everything baked before we release anything?

@islemaster

Copy link
Copy Markdown
Contributor Author

The goal effects now play on goals when the level loads, and are removed the first time the student presses Run.

@breville @cpirich please take another look. I've removed all SMIL animation and replaced it with JS-driven animation of the filter attributes, so the animations are now supported in IE10+. I still need to do the filter feature-detection so we ensure this work is skipped in IE9.

The effects are using their own setInterval which is kind of ugly, but I went ahead with it after realizing that I can't hook them up to Studio.onTick because I need the animations to run before the student hits the Run button.

@breville

Copy link
Copy Markdown
Member

seems reasonable to me. all the usual caveats about compatibility etc. :)

@islemaster

Copy link
Copy Markdown
Contributor Author

Added SVG filter feature-check.

islemaster added a commit that referenced this pull request Oct 29, 2015
Procedural animation effects for playlab goal objects
@islemaster islemaster merged commit 224dc67 into staging Oct 29, 2015
@islemaster islemaster deleted the pulse-item branch October 29, 2015 16:54
deploy-code-org added a commit that referenced this pull request Oct 29, 2015
224dc67 Merge pull request #4786 from code-dot-org/pulse-item (Brad Buchanan)
d619792 Automatically built. (Continuous Integration)
8403a32 Merge pull request #4920 from code-dot-org/testfixes (Elijah Hamovitz)
0ff348c Temporarily removing funOMeter test (Elijah Hamovitz)
b457e24 Merge pull request #4916 from code-dot-org/ie10tests (Bjvanminnen)
5b89e35 more IE10 (Brent Van Minnen)
1876a7f o Merge branch 'staging' of github.com:code-dot-org/code-dot-org into staging (Trevor Berg)
541fdc5 Fix issues with JSONFileDataAdapter (Trevor Berg)
0f13914 iOS requires directly-bound click events and 'cursor: pointer' style for click events to work (Elijah Hamovitz)
5b6b40f Feature-check SVG filter support before creating/applying a filter. (Brad Buchanan)
656f7c2 Merge pull request #4877 from code-dot-org/bundle_install_frontends (Will Jordan)
b7be14d Automatically built. (Continuous Integration)
16bc449 Merge pull request #4903 from code-dot-org/only_setup_local_pegasus_db (philbogle)
7460930 Merge pull request #4911 from code-dot-org/remerge-project-expect-channel (Josh Lory)
f53452b start running applab tests on IE 10 (Brent Van Minnen)
4907658 Merge pull request #4915 from code-dot-org/revert-4723-ajax_sign_in (philbogle)
c266d62 Revert "Render the sign-in/sign-out button in the Dashboard header using Ajax" (philbogle)
0dc2fb9 Header (and 'Remix' button) doesn't show up on mobile [ci skip] (Josh Lory)
7317599 Merge pull request #4913 from code-dot-org/all-responses (Laurel)
3130e6c Merge remote-tracking branch 'origin/staging' into pulse-item (Brad Buchanan)
e28f355 Deduplicate functions and remove last SMIL TODO comment. (Brad Buchanan)
9ac35c2 Merge pull request #4723 from code-dot-org/ajax_sign_in (philbogle)
deploy-code-org added a commit that referenced this pull request Oct 29, 2015
debbe71 Merge pull request #4919 from code-dot-org/ia-round2 (Caley Brock)
22108b6 Automatically built. (Continuous Integration)
224dc67 Merge pull request #4786 from code-dot-org/pulse-item (Brad Buchanan)
34e9f9e Merge branch 'staging' into ia-round2 (caleybrock)
d619792 Automatically built. (Continuous Integration)
8403a32 Merge pull request #4920 from code-dot-org/testfixes (Elijah Hamovitz)
0ff348c Temporarily removing funOMeter test (Elijah Hamovitz)
b457e24 Merge pull request #4916 from code-dot-org/ie10tests (Bjvanminnen)
5b89e35 more IE10 (Brent Van Minnen)
1876a7f o Merge branch 'staging' of github.com:code-dot-org/code-dot-org into staging (Trevor Berg)
541fdc5 Fix issues with JSONFileDataAdapter (Trevor Berg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants