Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Use AnimationCurve to make cool scroll view for Select 3D card character[github]

Discussion in 'Scripting' started by tinyant, Sep 28, 2016.

  1. tinyant

    tinyant

    Joined:
    Aug 28, 2015
    Posts:
    119
    AnimationCurve is very powerful and useful tools in developing game,the player's jumping, camera's path and so on.

    In this example I use three curves to make a scroll view for select 3d card character.
    1. Position Curve. Control item's position.
    2. Scale Curve. Control item's scale
    3. "Depth" Curve. For determine item's back and front relationship, It's can be UIWidget's depth in NGUI(2D) or the Item's Z position value in 3D world
    Features
    1. Click left right button to recenter item
    2. Click target to recenter and select item
    3. Drag feature: drag enhanceScrollview to recenter item
    4. Update item status with Curve horizontal time changing
    5. Edit control curves for scale, position, and "depth", you can add your own curve to control item other properties
    6. NGUI 2d, world 3d, and UGUI support

    How to use
    Easy to make your own Enhance Item

    1. open NGUIEnhanceScrollView.unity for NGUI example
    2. open UGUIEnhanceScrollView.unity for UGUI example
    Easy way to make better Curve: Copy EnhancedScrollView Component in example and paste it to your own TargetScrollView

    Get the source code from Github: https://github.com/tinyantstudio/EnhancedScrollView

    Help: I want to manual input the keyframe value for the AnimationCurve, not just drag and move the curve in the AnimationCurve Editor (this way is't precisely and easy to control I think). Input the key value will be easy for your AnimationCurve design.

    -Thanks-



    Screen Shot:

     

    Attached Files:

    eliteforcevn and yashpal like this.
  2. CloudKid

    CloudKid

    Joined:
    Dec 13, 2015
    Posts:
    207
    Are you looking for something like this?

    You can define key frames from code where:
    Code (CSharp):
    1. new Keyframe(value for time axis, value axis);
     
  3. tinyant

    tinyant

    Joined:
    Aug 28, 2015
    Posts:
    119
    thanks!
    yes I need to Enter the KeyFrame [key,value] to define the start and end point for the Curve start status.Next just drag and edit the Curve.
     
  4. tinyant

    tinyant

    Joined:
    Aug 28, 2015
    Posts:
    119
    :)make a curve editor by my own..
     
  5. levonfly

    levonfly

    Joined:
    May 16, 2017
    Posts:
    2
    I don't want to loop. What should I do?