diff --git a/Examples/TextEffects/AnimateEffects.cs b/Examples/TextEffects/AnimateEffects.cs new file mode 100644 index 0000000..397799c --- /dev/null +++ b/Examples/TextEffects/AnimateEffects.cs @@ -0,0 +1,55 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI.Extensions; + +public class AnimateEffects : MonoBehaviour +{ + + public LetterSpacing letterSpacing; + float letterSpacingMax = 10, letterSpacingMin = -10, letterSpacingModifier = 0.1f; + public CurvedText curvedText; + float curvedTextMax = 0.05f, curvedTextMin = -0.05f, curvedTextModifier = 0.001f; + public Gradient2 gradient2; + float gradient2Max = 1, gradient2Min = -1, gradient2Modifier = 0.01f; + public CylinderText cylinderText; + private Transform cylinderTextRT; + float cylinderTextMax = 0.5f, cylinderTextMin = -0.5f, cylinderTextModifier = 1f; + Vector3 cylinderRotation = new Vector3(0, 1, 0); + public SoftMaskScript SAUIM; + float SAUIMMax = 1, SAUIMMin = 0, SAUIMModifier = 0.01f; + // Use this for initialization + void Start() + { + cylinderTextRT = cylinderText.GetComponent(); + } + + // Update is called once per frame + void Update() + { + letterSpacing.spacing += letterSpacingModifier; + if (letterSpacing.spacing > letterSpacingMax || letterSpacing.spacing < letterSpacingMin) + { + letterSpacingModifier = -letterSpacingModifier; + } + curvedText.CurveMultiplier += curvedTextModifier; + if (curvedText.CurveMultiplier > curvedTextMax || curvedText.CurveMultiplier < curvedTextMin) + { + curvedTextModifier = -curvedTextModifier; + } + gradient2.Offset += gradient2Modifier; + if (gradient2.Offset > gradient2Max || gradient2.Offset < gradient2Min) + { + gradient2Modifier = -gradient2Modifier; + } + + cylinderTextRT.Rotate(cylinderRotation); + + SAUIM.CutOff += SAUIMModifier; + if (SAUIM.CutOff > SAUIMMax || SAUIM.CutOff < SAUIMMin) + { + SAUIMModifier = -SAUIMModifier; + } + + } +} diff --git a/Examples/TextEffects/AnimateEffects.cs.meta b/Examples/TextEffects/AnimateEffects.cs.meta new file mode 100644 index 0000000..a6db4fb --- /dev/null +++ b/Examples/TextEffects/AnimateEffects.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 1dc69a45cd2765d4db3933346112431a +timeCreated: 1496665065 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Examples/TextEffects/TextEffects.unity b/Examples/TextEffects/TextEffects.unity index 59237c2..668bbc5 100644 --- a/Examples/TextEffects/TextEffects.unity +++ b/Examples/TextEffects/TextEffects.unity @@ -13,7 +13,7 @@ OcclusionCullingSettings: --- !u!104 &2 RenderSettings: m_ObjectHideFlags: 0 - serializedVersion: 7 + serializedVersion: 8 m_Fog: 0 m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} m_FogMode: 3 @@ -25,6 +25,7 @@ RenderSettings: m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} m_AmbientIntensity: 1 m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} m_HaloStrength: 0.5 m_FlareStrength: 1 @@ -41,7 +42,7 @@ RenderSettings: --- !u!157 &3 LightmapSettings: m_ObjectHideFlags: 0 - serializedVersion: 7 + serializedVersion: 9 m_GIWorkflowMode: 0 m_GISettings: serializedVersion: 2 @@ -53,7 +54,7 @@ LightmapSettings: m_EnableBakedLightmaps: 1 m_EnableRealtimeLightmaps: 1 m_LightmapEditorSettings: - serializedVersion: 4 + serializedVersion: 8 m_Resolution: 2 m_BakeResolution: 40 m_TextureWidth: 1024 @@ -66,13 +67,27 @@ LightmapSettings: m_LightmapParameters: {fileID: 0} m_LightmapsBakeMode: 1 m_TextureCompression: 1 - m_DirectLightInLightProbes: 1 m_FinalGather: 0 m_FinalGatherFiltering: 1 m_FinalGatherRayCount: 256 m_ReflectionCompression: 2 + m_MixedBakeMode: 1 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFiltering: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousColorSigma: 1 + m_PVRFilteringAtrousNormalSigma: 1 + m_PVRFilteringAtrousPositionSigma: 1 m_LightingDataAsset: {fileID: 0} - m_RuntimeCPUUsage: 25 + m_ShadowMaskMode: 2 --- !u!196 &4 NavMeshSettings: serializedVersion: 2 @@ -89,6 +104,8 @@ NavMeshSettings: minRegionArea: 2 manualCellSize: 0 cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 accuratePlacement: 0 m_NavMeshData: {fileID: 0} --- !u!1 &53605608 @@ -123,10 +140,10 @@ RectTransform: m_Father: {fileID: 608925988} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 70, y: -48.2} - m_SizeDelta: {x: 283, y: 67} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 22.599998, y: 0.0000030994} + m_SizeDelta: {x: -407.7, y: -382.7} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &53605610 MonoBehaviour: @@ -139,7 +156,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: c38666cb4d43a304588cf0b7e5f86db6, type: 3} m_Name: m_EditorClassIdentifier: - curveForText: + _curveForText: serializedVersion: 2 m_Curve: - serializedVersion: 2 @@ -149,7 +166,7 @@ MonoBehaviour: outSlope: 10 tangentMode: 0 - serializedVersion: 2 - time: 283 + time: 274.3 value: 10 inSlope: 10 outSlope: 0 @@ -157,7 +174,7 @@ MonoBehaviour: m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 - curveMultiplier: 0.05 + _curveMultiplier: 0.05 --- !u!114 &53605611 MonoBehaviour: m_ObjectHideFlags: 0 @@ -366,9 +383,9 @@ RectTransform: m_Father: {fileID: 964402498} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0.5} - m_AnchorMax: {x: 0, y: 0.5} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 0, y: -11} m_SizeDelta: {x: 203, y: 30} m_Pivot: {x: 1, y: 0.5} --- !u!114 &475523924 @@ -433,7 +450,7 @@ Light: m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 522534722} m_Enabled: 1 - serializedVersion: 7 + serializedVersion: 8 m_Type: 1 m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} m_Intensity: 1 @@ -458,6 +475,8 @@ Light: m_Lightmapping: 4 m_AreaSize: {x: 1, y: 1} m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 m_ShadowRadius: 0 m_ShadowAngle: 0 --- !u!4 &522534724 @@ -543,6 +562,8 @@ Camera: m_TargetDisplay: 0 m_TargetEye: 3 m_HDR: 0 + m_AllowMSAA: 1 + m_ForceIntoRT: 0 m_OcclusionCulling: 1 m_StereoConvergence: 10 m_StereoSeparation: 0.022 @@ -560,6 +581,80 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &604047319 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 604047320} + - component: {fileID: 604047322} + - component: {fileID: 604047321} + m_Layer: 5 + m_Name: Label + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &604047320 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 604047319} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1971772018} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 1, y: 0.5} + m_AnchorMax: {x: 1, y: 0.5} + m_AnchoredPosition: {x: -16, y: 104} + m_SizeDelta: {x: 118, y: 31} + m_Pivot: {x: 1, y: 0.5} +--- !u!114 &604047321 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 604047319} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.41176468, g: 0.41176468, b: 0.41176468, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: SoftMaskScript.cs +--- !u!222 &604047322 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 604047319} --- !u!1 &608925987 GameObject: m_ObjectHideFlags: 0 @@ -570,6 +665,7 @@ GameObject: - component: {fileID: 608925988} - component: {fileID: 608925990} - component: {fileID: 608925989} + - component: {fileID: 608925991} m_Layer: 5 m_Name: Panel m_TagString: Untagged @@ -592,7 +688,9 @@ RectTransform: - {fileID: 1814753280} - {fileID: 53605609} - {fileID: 2095743670} - - {fileID: 1101119005} + - {fileID: 1279032582} + - {fileID: 1314876584} + - {fileID: 1971772018} m_Father: {fileID: 1402590855} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -634,6 +732,18 @@ CanvasRenderer: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 608925987} +--- !u!114 &608925991 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 608925987} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: -1200242548, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_ShowMaskGraphic: 1 --- !u!1 &697770936 GameObject: m_ObjectHideFlags: 0 @@ -664,9 +774,9 @@ RectTransform: m_Father: {fileID: 755348325} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0.5} - m_AnchorMax: {x: 0, y: 0.5} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 0, y: -50} m_SizeDelta: {x: 203, y: 30} m_Pivot: {x: 1, y: 0.5} --- !u!114 &697770938 @@ -740,10 +850,10 @@ RectTransform: m_Father: {fileID: 608925988} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 115, y: 134.9} - m_SizeDelta: {x: 372, y: 133.7} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: -5.6499996, y: 132.1} + m_SizeDelta: {x: -464.2, y: -337.7} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &755348326 MonoBehaviour: @@ -780,7 +890,7 @@ MonoBehaviour: Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} - m_FontSize: 14 + m_FontSize: 12 m_FontStyle: 0 m_BestFit: 0 m_MinSize: 1 @@ -831,10 +941,10 @@ RectTransform: m_Father: {fileID: 608925988} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 115, y: 228.5} - m_SizeDelta: {x: 372.05, y: 22.9} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 86.2, y: 196} + m_SizeDelta: {x: -278.7, y: -405.8} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &964402499 MonoBehaviour: @@ -985,18 +1095,17 @@ RectTransform: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1101119004} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 1314876584} - m_Father: {fileID: 608925988} - m_RootOrder: 5 + m_Children: [] + m_Father: {fileID: 1314876584} + m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 70, y: -200.6} - m_SizeDelta: {x: 283, y: 67} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 237.73999, y: 0} + m_SizeDelta: {x: 69.48001, y: 28.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1101119006 MonoBehaviour: @@ -1042,7 +1151,7 @@ MonoBehaviour: m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 - m_Text: Very long line of text that is curved nicely along multiple lines of important + m_Text: Very long line of text that is rotated nicely along multiple lines of important blind text. --- !u!222 &1101119008 CanvasRenderer: @@ -1124,6 +1233,164 @@ CanvasRenderer: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1218121587} +--- !u!21 &1232612834 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: UI Extensions/SoftMaskShader + m_Shader: {fileID: 4800000, guid: 947afae4d36f1274ea2e4098262ceef6, type: 3} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _AlphaMask: + m_Texture: {fileID: 2800000, guid: 73f1719d5b8f9a1499c5a719ab10e675, type: 3} + m_Scale: {x: 0.006666667, y: 0.005952381} + m_Offset: {x: -1.2133334, y: 1.202381} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _ColorMask: 15 + - _CutOff: 0 + - _FlipAlphaMask: 0 + - _HardBlend: 1 + - _NoOuterClip: 0 + - _Stencil: 0 + - _StencilComp: 8 + - _StencilOp: 0 + - _StencilReadMask: 255 + - _StencilWriteMask: 255 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &1279032581 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1279032582} + - component: {fileID: 1279032585} + - component: {fileID: 1279032584} + - component: {fileID: 1279032583} + m_Layer: 5 + m_Name: Gradient2 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1279032582 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1279032581} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1613750633} + m_Father: {fileID: 608925988} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 22.599998, y: -120} + m_SizeDelta: {x: -407.7, y: -371} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1279032583 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1279032581} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 45facfdc6a639f041b007c036dc527b8, type: 3} + m_Name: + m_EditorClassIdentifier: + _gradientType: 0 + _blendMode: 2 + _offset: 0 + _effectGradient: + serializedVersion: 2 + key0: {r: 0, g: 0, b: 0, a: 1} + key1: {r: 0.27647075, g: 0.27647075, b: 0.27647075, a: 1} + key2: {r: 1, g: 0.6985294, b: 0.6985294, a: 1} + key3: {r: 0.007352948, g: 0.007352948, b: 0.007352948, a: 1} + key4: {r: 1, g: 1, b: 1, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 9252 + ctime2: 36044 + ctime3: 52621 + ctime4: 65535 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 26021 + atime2: 47224 + atime3: 65535 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 5 + m_NumAlphaKeys: 4 +--- !u!114 &1279032584 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1279032581} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Very long line of text that is blended nicely along multiple lines of important + blind text. +--- !u!222 &1279032585 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1279032581} --- !u!1 &1314876583 GameObject: m_ObjectHideFlags: 0 @@ -1135,7 +1402,7 @@ GameObject: - component: {fileID: 1314876586} - component: {fileID: 1314876585} m_Layer: 5 - m_Name: Label + m_Name: CylinderText m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -1150,13 +1417,14 @@ RectTransform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 1101119005} - m_RootOrder: 0 + m_Children: + - {fileID: 1101119005} + m_Father: {fileID: 608925988} + m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 0, y: 0.5} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchoredPosition: {x: 228.121, y: -183.75} m_SizeDelta: {x: 203, y: 30} m_Pivot: {x: 1, y: 0.5} --- !u!114 &1314876585 @@ -1209,6 +1477,7 @@ GameObject: - component: {fileID: 1402590854} - component: {fileID: 1402590853} - component: {fileID: 1402590852} + - component: {fileID: 1402590856} m_Layer: 5 m_Name: Canvas m_TagString: Untagged @@ -1260,7 +1529,7 @@ Canvas: m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1402590851} m_Enabled: 1 - serializedVersion: 2 + serializedVersion: 3 m_RenderMode: 0 m_Camera: {fileID: 0} m_PlaneDistance: 100 @@ -1269,6 +1538,7 @@ Canvas: m_OverrideSorting: 0 m_OverridePixelPerfect: 0 m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 m_SortingLayerID: 0 m_SortingOrder: 0 m_TargetDisplay: 0 @@ -1291,6 +1561,96 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0, y: 0} +--- !u!114 &1402590856 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1402590851} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1dc69a45cd2765d4db3933346112431a, type: 3} + m_Name: + m_EditorClassIdentifier: + letterSpacing: {fileID: 964402499} + curvedText: {fileID: 53605610} + gradient2: {fileID: 1279032583} + cylinderText: {fileID: 1101119006} + SAUIM: {fileID: 1971772019} +--- !u!1 &1613750632 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1613750633} + - component: {fileID: 1613750635} + - component: {fileID: 1613750634} + m_Layer: 5 + m_Name: Label + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1613750633 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1613750632} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1279032582} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 0, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 203, y: 30} + m_Pivot: {x: 1, y: 0.5} +--- !u!114 &1613750634 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1613750632} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.41176468, g: 0.41176468, b: 0.41176468, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Gradient2.cs +--- !u!222 &1613750635 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1613750632} --- !u!1 &1814753279 GameObject: m_ObjectHideFlags: 0 @@ -1323,10 +1683,10 @@ RectTransform: m_Father: {fileID: 608925988} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 5, y: 30.9} - m_SizeDelta: {x: 154.1, y: 53.6} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: -34, y: 53.800003} + m_SizeDelta: {x: -520.9, y: -370.6} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1814753281 MonoBehaviour: @@ -1381,6 +1741,103 @@ CanvasRenderer: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1814753279} +--- !u!1 &1971772017 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1971772018} + - component: {fileID: 1971772021} + - component: {fileID: 1971772020} + - component: {fileID: 1971772019} + m_Layer: 5 + m_Name: SAUIM + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1971772018 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1971772017} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 604047320} + m_Father: {fileID: 608925988} + m_RootOrder: 7 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 257, y: -118} + m_SizeDelta: {x: -532, y: -258} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1971772019 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1971772017} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b8ee60af491978345bc197ed4e1316bc, type: 3} + m_Name: + m_EditorClassIdentifier: + MaskArea: {fileID: 1971772018} + AlphaMask: {fileID: 2800000, guid: 73f1719d5b8f9a1499c5a719ab10e675, type: 3} + CutOff: 0 + HardBlend: 1 + FlipAlphaMask: 0 + DontClipMaskScalingRect: 0 +--- !u!114 &1971772020 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1971772017} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 1232612834} + m_Color: {r: 0, g: 0, b: 0, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: 'Very long line of text that is blended nicely along multiple lines of important + blind text. + + What is interesting is the alpha effect from the Shader which can fade in and + out.' +--- !u!222 &1971772021 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1971772017} --- !u!1 &2095743669 GameObject: m_ObjectHideFlags: 0 @@ -1413,10 +1870,10 @@ RectTransform: m_Father: {fileID: 608925988} m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 70, y: -124} - m_SizeDelta: {x: 283, y: 67} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 22.599998, y: -52.875} + m_SizeDelta: {x: -408, y: -363.55} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &2095743671 MonoBehaviour: @@ -1429,11 +1886,11 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 0671953a9c649e5438e4d961d1983915, type: 3} m_Name: m_EditorClassIdentifier: - gradientMode: 0 - gradientDir: 0 - overwriteAllColor: 0 - vertex1: {r: 1, g: 1, b: 1, a: 1} - vertex2: {r: 0, g: 0, b: 0, a: 1} + _gradientMode: 0 + _gradientDir: 0 + _overwriteAllColor: 0 + _vertex1: {r: 1, g: 1, b: 1, a: 1} + _vertex2: {r: 0, g: 0, b: 0, a: 1} --- !u!114 &2095743672 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1466,7 +1923,7 @@ MonoBehaviour: m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 - m_Text: Very long line of text that is curved nicely along multiple lines of important + m_Text: Very long line of text that is blended nicely along multiple lines of important blind text. --- !u!222 &2095743673 CanvasRenderer: diff --git a/Examples/TextEffects/swirl.png b/Examples/TextEffects/swirl.png new file mode 100644 index 0000000..b3c8dc3 Binary files /dev/null and b/Examples/TextEffects/swirl.png differ diff --git a/Examples/TextEffects/swirl.png.meta b/Examples/TextEffects/swirl.png.meta new file mode 100644 index 0000000..239b07a --- /dev/null +++ b/Examples/TextEffects/swirl.png.meta @@ -0,0 +1,57 @@ +fileFormatVersion: 2 +guid: 73f1719d5b8f9a1499c5a719ab10e675 +timeCreated: 1447964200 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 4 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 0 + mipBias: -1 + wrapMode: 1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 5 + buildTargetSettings: [] + spriteSheet: + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/Effects/CurvedText.cs b/Scripts/Effects/CurvedText.cs index 07a1bb1..118cc9c 100644 --- a/Scripts/Effects/CurvedText.cs +++ b/Scripts/Effects/CurvedText.cs @@ -7,8 +7,24 @@ namespace UnityEngine.UI.Extensions [AddComponentMenu("UI/Effects/Extensions/Curved Text")] public class CurvedText : BaseMeshEffect { - public AnimationCurve curveForText = AnimationCurve.Linear(0, 0, 1, 10); - public float curveMultiplier = 1; + [SerializeField] + private AnimationCurve _curveForText = AnimationCurve.Linear(0, 0, 1, 10); + + public AnimationCurve CurveForText + { + get { return _curveForText; } + set { _curveForText = value; graphic.SetVerticesDirty(); } + } + + [SerializeField] + private float _curveMultiplier = 1; + + public float CurveMultiplier + { + get { return _curveMultiplier; } + set { _curveMultiplier = value; graphic.SetVerticesDirty(); } + } + private RectTransform rectTrans; @@ -16,15 +32,15 @@ namespace UnityEngine.UI.Extensions protected override void OnValidate() { base.OnValidate(); - if (curveForText[0].time != 0) + if (_curveForText[0].time != 0) { - var tmpRect = curveForText[0]; + var tmpRect = _curveForText[0]; tmpRect.time = 0; - curveForText.MoveKey(0, tmpRect); + _curveForText.MoveKey(0, tmpRect); } if (rectTrans == null) rectTrans = GetComponent(); - if (curveForText[curveForText.length - 1].time != rectTrans.rect.width) + if (_curveForText[_curveForText.length - 1].time != rectTrans.rect.width) OnRectTransformDimensionsChange(); } #endif @@ -51,7 +67,7 @@ namespace UnityEngine.UI.Extensions { UIVertex uiVertex = new UIVertex(); vh.PopulateUIVertex(ref uiVertex, index); - uiVertex.position.y += curveForText.Evaluate(rectTrans.rect.width * rectTrans.pivot.x + uiVertex.position.x) * curveMultiplier; + uiVertex.position.y += _curveForText.Evaluate(rectTrans.rect.width * rectTrans.pivot.x + uiVertex.position.x) * _curveMultiplier; vh.SetUIVertex(uiVertex, index); } } @@ -59,9 +75,9 @@ namespace UnityEngine.UI.Extensions { if (rectTrans) { - Keyframe tmpRect = curveForText[curveForText.length - 1]; + Keyframe tmpRect = _curveForText[_curveForText.length - 1]; tmpRect.time = rectTrans.rect.width; - curveForText.MoveKey(curveForText.length - 1, tmpRect); + _curveForText.MoveKey(_curveForText.length - 1, tmpRect); } } } diff --git a/Scripts/Effects/Gradient.cs b/Scripts/Effects/Gradient.cs index 512a1fe..d3387fd 100644 --- a/Scripts/Effects/Gradient.cs +++ b/Scripts/Effects/Gradient.cs @@ -24,8 +24,8 @@ namespace UnityEngine.UI.Extensions public GradientMode GradientMode { get { return _gradientMode; } set { _gradientMode = value; graphic.SetVerticesDirty(); } } public GradientDir GradientDir { get { return _gradientDir; } set { _gradientDir = value; graphic.SetVerticesDirty(); } } public bool OverwriteAllColor { get { return _overwriteAllColor; } set { _overwriteAllColor = value; graphic.SetVerticesDirty(); } } - public Color Vertex1 { get { return _vertex1; } set { _vertex1 = value; graphic.SetVerticesDirty(); } } - public Color Vertex2 { get { return _vertex2; } set { _vertex2 = value; graphic.SetVerticesDirty(); } } + public Color Vertex1 { get { return _vertex1; } set { _vertex1 = value; graphic.SetAllDirty(); } } + public Color Vertex2 { get { return _vertex2; } set { _vertex2 = value; graphic.SetAllDirty(); } } #endregion protected override void Awake()