Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

superfly-timeline

Package Overview
Dependencies
Maintainers
2
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

superfly-timeline - npm Package Compare versions

Comparing version 8.2.3 to 8.2.4-nightly-20220126-125225-9165fac.0

81

dist/resolver/state.js

@@ -270,4 +270,2 @@ "use strict";

activeObjIds[newObjInstance.id] = newObjInstance;
// Update the tracking state as well:
setStateAtTime(resolvedStates.state, layer, time, newObjInstance);
// Add to nextEvents:

@@ -285,4 +283,2 @@ resolvedStates.nextEvents.push({

delete currentState[layer];
// Update the tracking state as well:
setStateAtTime(resolvedStates.state, layer, time, null);
changed = true;

@@ -398,4 +394,74 @@ }

}
// At this point, all instances of the objects should be properly calculated.
// Go through all instances of all objects to create temporary states of all layers and times:
{
const states = {};
for (const id of Object.keys(resolvedStates.objects)) {
const obj = resolvedStates.objects[id];
const layer = `${obj.layer}`;
if (!states[layer])
states[layer] = {};
const stateLayer = states[layer];
if (!obj.resolved.isKeyframe) {
for (const instance of obj.resolved.instances) {
const startTime = instance.start + '';
if (!stateLayer[startTime]) {
stateLayer[startTime] = {
startCount: 0,
endCount: 0,
objectInstance: null,
};
}
const newObjInstance = {
...obj,
instance: instance,
};
stateLayer[startTime].startCount++;
stateLayer[startTime].objectInstance = newObjInstance;
if (instance.end) {
const endTime = instance.end + '';
if (!stateLayer[endTime]) {
stateLayer[endTime] = {
startCount: 0,
endCount: 0,
objectInstance: null,
};
}
stateLayer[endTime].endCount++;
}
}
}
}
// Go through the temporary states and apply the changes to the resolvedStates.state:
for (const layer of Object.keys(states)) {
let sum = 0;
for (const time of Object.keys(states[layer])) {
const s = states[layer][time];
sum += s.startCount;
sum -= s.endCount;
// Check for fatal bugs:
// If the sum is larger than one, more than one start was found at the same time, which should not be possible.
if (sum > 1)
throw new Error(`Too many start events at ${layer} ${time}: ${sum}`);
// If the sum is less than zero, there have been more ends than starts, which should not be possible.
if (sum < 0)
throw new Error(`Too many end events at ${layer} ${time}: ${sum}`);
// Apply the state:
if (!resolvedStates.state[layer])
resolvedStates.state[layer] = {};
if (sum) {
// This means that the object has started
if (!s.objectInstance)
throw new Error(`objectInstance not set, event though sum=${sum} at ${layer} ${time}`);
resolvedStates.state[layer][time] = [s.objectInstance];
}
else {
// This means that the object has ended
resolvedStates.state[layer][time] = null;
}
}
}
}
// Cap keyframes inside their parents:
for (const id of Object.keys(resolvedStates.objects)) {
// Cap keyframes inside their parents:
{

@@ -495,7 +561,2 @@ const keyframe = resolvedStates.objects[id];

}
function setStateAtTime(states, layer, time, objInstance) {
if (!states[layer])
states[layer] = {};
states[layer][time + ''] = objInstance ? [objInstance] : objInstance;
}
function addKeyframeAtTime(states, layer, time, objInstanceKf) {

@@ -502,0 +563,0 @@ if (!states[layer])

2

package.json
{
"name": "superfly-timeline",
"version": "8.2.3",
"version": "8.2.4-nightly-20220126-125225-9165fac.0",
"description": "A collection of rules as well as a resolver for placing objects on a virtual timeline.",

@@ -5,0 +5,0 @@ "license": "MIT",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc