logo

Live Production Software Forums


Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
doggy  
#1 Posted : Sunday, December 28, 2014 11:29:12 AM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,072
Belgium
Location: Belgium

Thanks: 283 times
Was thanked: 920 time(s) in 759 post(s)
Hi

Will vMix title Xaml codebehind allow to trigger an animation based on the content of a textblock ( or other control) ?

Thanks to the 'DynamicImage title' Martin posted I was able to use this example to autoupdate a listdisplay from a xml file.
Using another title ( as .dll) I managed to let animation play coded in codebehind.
So certain things I managed to get working.

As externally triggering animations (similar to what Casparcg does with its flash templates) is not an option I thought about using values as triggers

aim is to animate in a extra background to display some info only when needed in addition to the standaard ones shown at load.
Trying to avoid having to use 2 or more titles for the effect.

thanks
Guy
doggy  
#2 Posted : Wednesday, December 31, 2014 8:37:30 AM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,072
Belgium
Location: Belgium

Thanks: 283 times
Was thanked: 920 time(s) in 759 post(s)
Not managing any form of triggered animation :-(
But at least I can make a "background" disappear when a value is empty.

Quote:
Imports System.Windows.Threading
Imports System.Windows.Media.Imaging
Imports System.IO
Imports System.Windows.Media.Animation

Public Class UserControl1


Private Sub UserControl1_DataContextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LayoutUpdated

If ToHideLabel.Text = "" Then
ToHideBox.Visibility = System.Windows.Visibility.Hidden

Else
ToHideBox.Visibility = System.Windows.Visibility.Visible

End If

End Sub
End Class
doggy  
#3 Posted : Wednesday, December 31, 2014 12:46:25 PM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,072
Belgium
Location: Belgium

Thanks: 283 times
Was thanked: 920 time(s) in 759 post(s)
A bit of success

a little demo here



Guy
tnorrell  
#4 Posted : Friday, January 2, 2015 4:44:07 PM(UTC)
tnorrell

Rank: Advanced Member

Groups: Registered
Joined: 12/6/2014(UTC)
Posts: 62
Location: Texas, US

Thanks: 21 times
Was thanked: 13 time(s) in 10 post(s)
Nice!
claudeir  
#5 Posted : Friday, February 14, 2020 3:14:13 AM(UTC)
claudeir

Rank: Member

Groups: Registered
Joined: 2/2/2018(UTC)
Posts: 13
Location: Foz do Iguaçu

Thanks: 5 times
Hi friends, How can I use that??

Originally Posted by: doggy Go to Quoted Post
Not managing any form of triggered animation :-(
But at least I can make a "background" disappear when a value is empty.

Quote:
Imports System.Windows.Threading
Imports System.Windows.Media.Imaging
Imports System.IO
Imports System.Windows.Media.Animation

Public Class UserControl1


Private Sub UserControl1_DataContextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LayoutUpdated

If ToHideLabel.Text = "" Then
ToHideBox.Visibility = System.Windows.Visibility.Hidden

Else
ToHideBox.Visibility = System.Windows.Visibility.Visible

End If

End Sub
End Class


doggy  
#6 Posted : Friday, February 14, 2020 4:58:51 AM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,072
Belgium
Location: Belgium

Thanks: 283 times
Was thanked: 920 time(s) in 759 post(s)
Originally Posted by: claudeir Go to Quoted Post
Hi friends, How can I use that??




To show or hide a colored rectangle

or

By using this bit of code in your xaml title ( using Blend for Visual Studio )

You might have noticed that the original post is 5 years old and I knew zero about xaml . Ultimately this bit code was "found" by comparing the example mentioned (still available for download) and a lot of using Google ;-)


davidcallahan  
#7 Posted : Friday, February 14, 2020 6:47:50 PM(UTC)
davidcallahan

Rank: Advanced Member

Groups: Registered
Joined: 1/22/2020(UTC)
Posts: 47
France
Location: Montpellier

Thanks: 14 times
Was thanked: 2 time(s) in 2 post(s)
Hi Doggy !
I allow myself into this conversation as I'm currently having trouble right into the topic.

If you remember, I'm working on my bar charts project, data is binded to Gsheet, so I use the data manager to change what graph I want to see.
There's an animation when the graph is set on screen, but I'll have to change quickly from on line to another one but the bars won't get updated : Only the text and it's position will.
Here is the video showing my issue :


I made this using BarGraph Elements in Blend for Visual Studio, I managed to change the style of them, and now I feel like I have to confront myself to codebehind.
I tried to use EventTriggers as below :
Code:

        <EventTrigger RoutedEvent="Binding.TargetUpdated">
            <BeginStoryboard>
                <Storyboard>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(RangeBase.Value)" Storyboard.TargetName="progressBar8">
                        
                        <SplineDoubleKeyFrame KeyTime="0:0:0" Value="0"/>
                        <SplineDoubleKeyFrame KeyTime="0:0:0.7" Value="0"/>
                        <SplineDoubleKeyFrame KeyTime="0:0:1.7" Value="{Binding Path=Text, ElementName=ValProg8}" KeySpline="0,0,0,1"/>
                    </DoubleAnimationUsingKeyFrames>
                </Storyboard>
            </BeginStoryboard>
        </EventTrigger>


With below :

Code:
        <TextBlock  Name="BarValTrig1" Text="{Binding Path=Text,ElementName=ValBar1, NotifyOnTargetUpdated=True}" FontSize="72" RenderTransformOrigin="0.5,0.5" Visibility="Hidden" />


From what I understood I need this "BarValTrig1" Text to send the update notification that should get triggered in the code above, but it doesn't work. Would've been amazing!

So I think my last chance is to use code behind and .dll

I understood (From our talks and Google) that I should :

- Make the .XAML file
- Create the code behind
- Trigger the animation when a data is changed, using the INotifyPropertyChanged or any other triggering solution.
- Compile the .dll
- Import both .dll and .xaml to VMIX.


So we are in the "XAML and Codebehind" topic, here is my question : How to create and compile the .dll ? How to bind my XAML and CS code ?

Thanks a lot :)

David
doggy  
#8 Posted : Friday, February 14, 2020 7:02:02 PM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,072
Belgium
Location: Belgium

Thanks: 283 times
Was thanked: 920 time(s) in 759 post(s)
Looks nice !

Quote:
- Import both .dll and .xaml to VMIX.


no , only the .dll

it looks like you are not triggering the animations on a data change , that is they are only triggering on loading the title which is standard in vMix

Quote:
use code behind and .dll


Yes or just reload the title meaning overlay of and on again (currently)?
doggy  
#9 Posted : Friday, February 14, 2020 7:10:10 PM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,072
Belgium
Location: Belgium

Thanks: 283 times
Was thanked: 920 time(s) in 759 post(s)
davidcallahan  
#10 Posted : Friday, February 14, 2020 7:11:43 PM(UTC)
davidcallahan

Rank: Advanced Member

Groups: Registered
Joined: 1/22/2020(UTC)
Posts: 47
France
Location: Montpellier

Thanks: 14 times
Was thanked: 2 time(s) in 2 post(s)
Thanks a lot !

Originally Posted by: doggy Go to Quoted Post

no , only the .dll

Ok, so the xaml is embedded in the .dll file ?

Originally Posted by: doggy Go to Quoted Post

it looks like you are not triggering the animations on a data change , that is they are only triggering on loading the title which is standard in vMix

Exactly. I found out that vMix triggers "Storyboard 1" for the IN animation and "Storyboard 2" for the OUT. It looks like it's proper XAML, but it doesn't trigger.
When I test it with the opacity of a textblock, it almost works : The text disappears, but not following the animation. I tried this example :
Code:
<DataTemplate.Triggers>
    <EventTrigger RoutedEvent="Binding.TargetUpdated">
        <BeginStoryboard>
           <Storyboard>
              <DoubleAnimation Duration="0:0:5" To="0.0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="idField"/>
           </Storyboard>
        </BeginStoryboard>
    </EventTrigger>
</DataTemplate.Triggers>

With
Code:
<TextField Name="idField" Text="{Binding ID, NotifyOnTargetUpdated=True}" />

Found there : https://stackoverflow.co...animation-on-data-change

Originally Posted by: doggy Go to Quoted Post

Yes or just reload the title meaning overlay of and on again (currently)?

You mean : Play OUT animation -> changing data line -> play IN ?
It could work of course, but the thing is there's a journalist explaining every numbers from every cities quickly, so it's been asked to switch without going back to the journalist camera.
(But if I can't make it they won't have choice :D )

Thanks again Doggy ! You really helped me out with this !

davidcallahan  
#11 Posted : Friday, February 14, 2020 7:33:14 PM(UTC)
davidcallahan

Rank: Advanced Member

Groups: Registered
Joined: 1/22/2020(UTC)
Posts: 47
France
Location: Montpellier

Thanks: 14 times
Was thanked: 2 time(s) in 2 post(s)


Thanks a lot, I've read this a lot unfortunately, and I don't think it helps : Trigger works fine for mouse changes, but for data content it is said the best is DataTrigger.
But those works when you know what value will be given. So the last option remaining is EventTrigger, but as I said earlier it looks like it's not working :/

//And I still don't get how to create a simple 1 textbox .dll :/

EDIT : I managed to create my first .dll ! With it's IN and OUT animation.
Now I'm working on calling storyboards and getting the IPropertyChangedValue trigger
doggy  
#12 Posted : Friday, February 14, 2020 8:07:17 PM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,072
Belgium
Location: Belgium

Thanks: 283 times
Was thanked: 920 time(s) in 759 post(s)
Quote:
works when you know what value will be given


or compare old value with new ;-)
davidcallahan  
#13 Posted : Friday, February 14, 2020 8:12:38 PM(UTC)
davidcallahan

Rank: Advanced Member

Groups: Registered
Joined: 1/22/2020(UTC)
Posts: 47
France
Location: Montpellier

Thanks: 14 times
Was thanked: 2 time(s) in 2 post(s)
Originally Posted by: doggy Go to Quoted Post

or compare old value with new ;-)


Hey this would be awesome, but it can be compared only on codebehind right ? Or does xaml handles it ?
doggy  
#14 Posted : Friday, February 14, 2020 9:06:37 PM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,072
Belgium
Location: Belgium

Thanks: 283 times
Was thanked: 920 time(s) in 759 post(s)
Originally Posted by: davidcallahan Go to Quoted Post
Originally Posted by: doggy Go to Quoted Post

or compare old value with new ;-)


Hey this would be awesome, but it can be compared only on codebehind right ? Or does xaml handles it ?


Codebehind

check pm
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.