solidKind: ['linear', 'conic'].find(kind => kinds.includes(kind)) || kinds[0],
3815 baseGeometry: geometry.get(animatedHTML.steps[0].styles), 3816 baseColor: undefined, 3821 * Значения слоев свойства в режиме градиента на шаге. Слои, которых нет у цвета шага, прозрачные. 3822 * У color на шаге с цветом css-цвет текста прозрачный - текст рисует слой, на шаге без цвета - собственный цвет текста 3824 * @param {sbsColorTarget} target 3825 * @param {stepStyles | null} styles - стили шага, null - исходный вид узла (шаг 0) 3826 * @param {'color' | 'bgColor'} prop 3827 * @returns {sbsPaintState} 3829function t_animationSBS__getTargetStepPaint(target, styles, prop) { 3830 const meta = target.paint[prop]; 3831 const value = styles ? styles[prop] : null; 3832 const geometry = (styles && meta.geometry.get(styles)) || meta.baseGeometry; 3833 const isGradient = t_animationSBS__isGradientPaint(value); 3834 const transparent = [0, 0, 0, 0]; 3837 meta.kinds.forEach(kind => { 3838 const count = meta.stops[kind]; 3839 let colors = Array.from({ length: count }, () => transparent); 3840 if (isGradient && value.kind === kind) { 3841 colors = t_animationSBS__normalizeStops(value.stops, count).map(stop => stop.color); 3842 } else if (value && !isGradient && meta.solidKind === kind) { 3843 colors = Array.from({ length: count }, () => value); 3845 state[kind] = Object.assign({}, geometry[kind], { colors }); 3847 if (prop === 'color') state.color = value ? transparent : meta.baseColor; 3852 * Смешивает значения слоев так же, как t_animationSBS__mixColors цвета: для анимации по скроллу 3854 * @param {sbsPaintState} from 3855 * @param {sbsPaintState} to 3856 * @param {number} percentage - доля смешивания от 0 до 1 3857 * @returns {sbsPaintState} 3859function t_animationSBS__mixPaint(from, to, percentage) { 3860 const mixNumber = (fromNumber, toNumber) => fromNumber + percentage * (toNumber - fromNumber); 3861 const mixLength = (fromLength, toLength) => { 3862 return { p: mixNumber(fromLength.p, toLength.p), x: mixNumber(fromLength.x, toLength.x) }; 3865 Object.keys(to).forEach(kind => { 3866 if (kind === 'color') { 3867 state.color = t_animationSBS__mixColors(from.color, to.color, percentage); 3870 const fromLayer = from[kind]; 3871 const toLayer = to[kind]; 3873 colors: toLayer.colors.map((color, i) => t_animationSBS__mixColors(fromLayer.colors[i], color, percentage)), 3874 positions: toLayer.positions.map((pos, i) => mixNumber(fromLayer.positions[i], pos)), 3876 if (toLayer.angle !== undefined) state[kind].angle = mixNumber(fromLayer.angle, toLayer.angle); 3877 if (toLayer.center) { 3878 state[kind].center = { 3879 x: mixLength(fromLayer.center.x, toLayer.center.x), 3880 y: mixLength(fromLayer.center.y, toLayer.center.y), 3884 state[kind].size = { 3885 w: mixLength(fromLayer.size.w, toLayer.size.w), 3886 h: mixLength(fromLayer.size.h, toLayer.size.h), 3894 * Css-декларации значений слоев: переменные слоев и, у color, css-цвет текста. 3895 * Ставятся в keyframes, а при анимации по скроллу - инлайном на узел 3897 * @param {sbsPaintMeta} meta 3898 * @param {sbsPaintState} state 3899 * @returns {string[][]} - пары [свойство, значение]