MCPcopy Index your code
hub / github.com/4ian/GDevelop / tweenColorEffectPropertyTween

Function tweenColorEffectPropertyTween

Extensions/TweenBehavior/tweentools.ts:725–771  ·  view source on GitHub ↗
(
        runtimeScene: RuntimeScene,
        identifier: string,
        toColorStr: string,
        layerName: string,
        effectName: string,
        propertyName: string,
        easing: string,
        duration: float
      )

Source from the content-addressed store, hash-verified

723 * @param duration Duration in seconds
724 */
725 export const tweenColorEffectPropertyTween = (
726 runtimeScene: RuntimeScene,
727 identifier: string,
728 toColorStr: string,
729 layerName: string,
730 effectName: string,
731 propertyName: string,
732 easing: string,
733 duration: float
734 ) => {
735 const layer = runtimeScene.getLayer(layerName);
736 const effect = layer.getRendererEffects()[effectName];
737 if (!effect) {
738 logger.error(
739 `The layer "${layer.getName()}" doesn't have any effect called "${effectName}"`
740 );
741 }
742 const rgbFromColor = gdjs.hexNumberToRGB(
743 effect ? effect.getColorParameter(propertyName) : 0
744 );
745 const rgbToColor: float[] = gdjs.rgbOrHexToRGBColor(toColorStr);
746
747 getTweensMap(runtimeScene).addMultiTween(
748 identifier,
749 layer,
750 duration,
751 easing,
752 linearInterpolation,
753 gdjs.evtTools.tween.rgbToHsl(
754 rgbFromColor.r,
755 rgbFromColor.g,
756 rgbFromColor.b
757 ),
758 gdjs.evtTools.tween.rgbToHsl(
759 rgbToColor[0],
760 rgbToColor[1],
761 rgbToColor[2]
762 ),
763 getTweenColorEffectPropertySetter(effect, propertyName),
764 {
765 type: 'colorEffectProperty',
766 layerName,
767 effectName,
768 propertyName,
769 }
770 );
771 };
772 }
773 }
774}

Callers

nothing calls this directly

Calls 8

getTweensMapFunction · 0.85
getRendererEffectsMethod · 0.80
addMultiTweenMethod · 0.80
errorMethod · 0.65
getNameMethod · 0.65
getColorParameterMethod · 0.65
getLayerMethod · 0.45

Tested by

no test coverage detected