Graphics

 View Only
  • 1.  Visual Logic Color Change based on DataLinq Strings?

    Posted 09-27-2022 10:01

    Hello,

    I have a .xlsx sheet with some names on it. In the project I have a quad and a text object over it, so I need to change the color of the quad based on string/name from the DataLinq object. I have lets say 11 possible names, so we have same amount of colors (11) to chose from.

    I need something like:

    if(name1)
           quad color = color1

    if(name2)
           quad color = color2

    etc..

    or something like switch

    switch(names):
         case name1: quad color = color1
    break
         case name2: quad color = color2
    break

    is it possible to do it with VisualLogic?



    ------------------------------
    Svetlin Aleksandrov
    Motion Graphic Designer
    Euronews Bulgaria
    ------------------------------


  • 2.  RE: Visual Logic Color Change based on DataLinq Strings?

    Posted 09-27-2022 10:20
    Here's an example I already had built from years ago comparing a text object to a value. That text object could be tied to your datalinq or you can use a datalinq block. 



    Alternatively you can script something like;


    dim Slab as xpSlabObject
    dim Blu, Red, Grn as xpMaterial
    dim Value as xpTextObject

     

    self.GetObjectByName("Slab1",Slab)
    self.Project.GetMaterialByName("Blue",Blu)
    self.Project.GetMaterialByName("Red",Red)
    self.Project.GetMaterialByName("Green",Grn)

    self.GetObjectByName("Text1", Value)

    if Value.Text = "Blue"

    Slab.SetMaterial(1,Blu)
    else if Value.Text = "Red"

    Slab.SetMaterial(1,Red)
    else
    Slab.SetMaterial(1,Grn)
    end if

    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 3.  RE: Visual Logic Color Change based on DataLinq Strings?

    Posted 09-27-2022 11:01
    Hi Svetlin
    This is an easy way if you are using a dynamic material.
    Create 11 materials named as a string in datalinq. Color is a text object connected to datalinq.



    ------------------------------
    Roman Yaroshenko
    chief specialist
    RBC-TV
    Moscow Russian Federation
    ------------------------------



  • 4.  RE: Visual Logic Color Change based on DataLinq Strings?

    Posted 09-27-2022 11:05
    Ah yes, do what Roma said, that is the most simple solution.

    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 5.  RE: Visual Logic Color Change based on DataLinq Strings?

    Posted 09-28-2022 08:55

    Thanks both of you! I have added the colors, also I have used the same method to add pictures to the names.



    ------------------------------
    Svetlin Aleksandrov
    Motion Graphic Designer
    Euronews Bulgaria
    ------------------------------