Repository navigation
feat(motion-presets): export param schemas for presets (without the #330 refactor) - #340
Open
ameerf-wix wants to merge 5 commits into
Open
ameerf-wix wants to merge 5 commits into
ameerf-wix wants to merge 5 commits into
Conversation
Port the per-preset `schema` exports from #330 onto the current preset implementations, without the base-presets refactor: - entrance, scroll and ongoing presets export #330's schemas and accept its param names; defaults are read from the schema - mouse presets export schemas for their current params (also attached to the create function, which is what gets registered) - getNames appends `options.suffix` to every keyframe name - generic contract test: implicit defaults equal schema defaults - docs/rules/skill references updated to the new param names Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- calc() lengths for every length param and rad/grad/turn/calc() angles for GlideIn/ExpandIn `from` (CSS cos()/sin() path) - Cross moves toward its direction (keyframes were frozen before measuring) - StretchScroll CSS fade matches WAAPI; PanScroll prepare measures by default - SpinIn fade capped at the animation duration - keyframe names collide only when keyframes are identical: units and per-param values moved into custom properties, timing-based shapes keyed on the rounded timing factor, ShuttersScroll names per range/stagger, step-start fades renamed to motion-fadeInStep - custom properties carry the suffix, so keyframe slots don't override each other - shutter count clamped to a positive integer (non-integers looped forever) - CurveIn vertical curves (top/bottom) covered by tests Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…elays - ongoing amounts are the peaks the keyframes reach (Pulse, Rubber, Wiggle, Bounce, Poke, Jello), as in #330 - iterationDelay holds at rest after an unchanged motion (holdAtRest) - getScrollParallax: visual speed relative to the scroll for GrowScroll, ShrinkScroll, Spin3dScroll, TiltScroll and ParallaxScroll (speed/center), by translating and widening the scroll range - Cross supports CSS (style + prepare); Pulse keeps the layout rotation; Spin no longer rotates rotated elements twice; Swing's CSS easings are real values - keyframe names include the easing where keyframes use it - motion: persist the animations of layered effects so finished layers are not auto-removed - remove the unused transitionDelay option everywhere Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Contributor
Generated
|
This branch has not been deployed
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 characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Takes the per-preset
schemaexports out of #330 so a version of #331 (validatingnamedEffectparams against the registered effect's schema) can merge without the big base-presets refactor. Type: feature with breaking param changes.What's included
schemawith the same keys, types, values,min/max/intand defaults. The defaults are written into the schema itself; there is noDEFAULTSobject. Implementations read their defaults fromschema.<param>.default.from,travel,pivot,scale,stretch,speed, etc.). Each new value is converted to the master implementation's internal value. The keyframes, base presets and utils are master's; none of the refactor came along.createfunction, the schema is also set on it ascreate.schema.suffix: every preset'sgetNamesappendsoptions.suffixto its keyframe names, so the keyframe slots thatgenerate()added in feat(interact): keyframe slots and view-timeline lists in generate() #338 work with presets.LengthInput/LengthValueintypes.ts, andSCROLL_RANGES,SHAPESandCENTER_AND_FOUR_DIRECTIONSinconsts.ts.Making every accepted param take effect (second commit)
lengthparam acceptscalc(). GlideIn/ExpandInfromacceptsrad/grad/turn/calc()angles and computes those through CSScos()/sin(). Plain values produce the same output as before.direction. Its keyframes used to be frozen before the element was measured. The wrap offsets for three of the diagonals are also fixed.preparemeasures whenstartFromOffScreenis left at its default.angle/perspectivewere written into the keyframes. They are now custom properties.centerratio was written into the keyframes. It is now a custom property.-staggeredfor continuous.motion-fadeInStep.var()fallbacks are ignored, since every animation declares its properties.suffix: custom properties now carry the suffix too (as in refactor(motion-presets): consolidate entrance, scroll and ongoing presets on shared base presets with schemas #330), so keyframe-slotted effects on one element don't override each other. A contract test checks that every declared property is suffixed and everyvar()used is declared. The only exceptions are--motion-rotateand the measured--motion-left.intyet.from: 'top'/'bottom') is covered by tests. On master,pseudoLeft/pseudoRightwere lowercased by the parser and never matched.Exact amounts, parallax speed and loop delays (third commit)
scale(its light beat is 4/7 of the depth), Rubberstretch(the first squash is 1 ± stretch), Wiggleangle/travel, Bounce/Poketraveland Jelloskeware the values the keyframes actually reach, as in refactor(motion-presets): consolidate entrance, scroll and ongoing presets on shared base presets with schemas #330.iterationDelay: each cycle's motion is unchanged and is followed by a hold at rest (holdAtRest). Breathe, Fold and Swing used to switch to a different keyframe sequence when delayed, and Fold's and Swing's ran into the delay. Presets without a rest keyframe at the end animated back to their base value during the delay (Spin, for example).speedandcenter: one util,getScrollParallax, gives GrowScroll, ShrinkScroll, Spin3dScroll, TiltScroll and ParallaxScroll the visual speed relative to the scroll, using refactor(motion-presets): consolidate entrance, scroll and ongoing presets on shared base presets with schemas #330's geometry. It translates the element and widens or narrows the scroll range by 1/speed. It's exact for elements smaller than the viewport; taller elements drift on entry, exit and contain ranges, as in refactor(motion-presets): consolidate entrance, scroll and ongoing presets on shared base presets with schemas #330.style+prepare). Without measurement, the wrap is at half the cycle, as in refactor(motion-presets): consolidate entrance, scroll and ongoing presets on shared base presets with schemas #330.var().transitionDelayis removed: nothing ever read it. It's gone from the motion/interact types, the validate schema, docs, rules, skills and the playground.Defaults
With no params, every preset produces master's output, with these exceptions:
indefault scale is 0.25 instead of 0, as documented in refactor(motion-presets): consolidate entrance, scroll and ongoing presets on shared base presets with schemas #330.out/continuousdefault scale is 1/1.2 instead of 0.8. The schema has a single default, so the range-dependent default can't be expressed.speed: 0.7159) matches the old look only for elements about 26vh tall. Taller elements travel further and shorter ones less, as in refactor(motion-presets): consolidate entrance, scroll and ongoing presets on shared base presets with schemas #330.depthis now the full depth (refactor(motion-presets): consolidate entrance, scroll and ongoing presets on shared base presets with schemas #330's meaning). The default output computes to the same value, but the CSS strings differ (e.g.calc(-1 * 100px)instead ofcalc(-1 * 200px / 2)).Equivalence was checked by comparing old and new
style/weboutput, at defaults and with converted non-default values.Remaining differences from #330
rangemeaning: in refactor(motion-presets): consolidate entrance, scroll and ongoing presets on shared base presets with schemas #330,outisinreversed andcontinuousisinfollowed byout; that isn't ported here. Scrolldirectionnow means where the motion goes ("to"). The defaults of PanScroll, SkewPanScroll, SlideScroll and TurnScroll were flipped so they look the same as before. As a result,range: 'out'on its own now goes the other way, and SkewPanScroll'soutends at the opposite skew.left/bottompivots now fold towards the viewer first, as in refactor(motion-presets): consolidate entrance, scroll and ongoing presets on shared base presets with schemas #330.Breaking changes
#330's param renames, for example
direction→fromon entrance presets,intensity→ explicit amounts on ongoing presets, andparallaxFactor→speed. The full list is in the updatedrules/presets/*.Tests
src/test/presets.spec.ts: refactor(motion-presets): consolidate entrance, scroll and ongoing presets on shared base presets with schemas #330's generic contract test (implicit defaults equal explicit schema defaults,getNamesmatches the animation names,webandstyleagree, schema defaults are valid). Presets withoutstyle, such as Cross, are rendered withweb. Mouse presets get the defaults and validity checks.persisttests). All package test suites, the build, eslint and prettier pass. Thetsc -p tsconfig.jsonerrors inWinkIn.spec.tsalready exist on master.Checklist
Additional Notes
apps/playground,apps/demoandapps/websitestill use the old param names, as in refactor(motion-presets): consolidate entrance, scroll and ongoing presets on shared base presets with schemas #330.🤖 Generated with Claude Code