Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
initialize() {
const props = this.props
const parent = this.parent
const targetScroll = Math.floor(props.offset) * parent.space
const offset = parent.space * props.offset + targetScroll * props.speed
const to = parseFloat(-(parent.current * props.speed) + offset)
this.animatedTranslate = new AnimatedValue(to)
this.animatedSpace = new AnimatedValue(parent.space * props.factor)
}
const convert = (acc, [name, value]) => ({
...acc,
[name]: new AnimatedValue(value),
});
const overwrite = (width, height) => (acc, [name, value]) => ({
import React, { Component } from 'react'
import ReactDOM from 'react-dom'
import { AnimatedValue, Spring, animated, interpolate, controller as spring } from 'react-spring'
import { database } from 'firebase';
import { action } from '@storybook/addon-actions'
const animation = new AnimatedValue(1)
const animations = {
opacity: {
opacity: animation.interpolate({ range: [1, 2], output: ['0', '1'] })
}
}
const animationMap = (animationType) => {
return animations[animationType]
}
export default class AnimatedSection extends Component {
constructor(props) {
super(props)
}
import React, { Component } from 'react'
import { AnimatedValue, Spring, animated, interpolate, controller as spring } from 'react-spring'
const animation = new AnimatedValue(1)
const animationChecker = ['opacity', 'slideFromLeft', 'slideFromRight']
const animations = Object.freeze({
opacity: {
opacity: animation.interpolate({ range: [1, 2], output: ['0', '1'] })
}
})
const animationMap = (animationType) => {
return animations[animationType]
}
/**
* Component for animating children.
* For now it only supports opacity and slide form left or slide from right. More to be added
*
scrollTo(offset) {
const { horizontal, config, impl } = this.props
const scrollType = getScrollType(horizontal)
this.scrollStop()
this.offset = offset
const target = this.container
this.animatedScroll = new AnimatedValue(target[scrollType])
this.animatedScroll.addListener(({ value }) => (target[scrollType] = value))
controller(
this.animatedScroll,
{ to: offset * this.space, ...config },
impl
).start()
}
initialize() {
const props = this.props
const parent = this.parent
const targetScroll = Math.floor(props.offset) * parent.space
const offset = parent.space * props.offset + targetScroll * props.speed
const to = parseFloat(-(parent.current * props.speed) + offset)
this.animatedTranslate = new AnimatedValue(to)
this.animatedSpace = new AnimatedValue(parent.space * props.factor)
}