update gradient

This commit is contained in:
franknstayn
2022-01-19 19:48:15 +08:00
parent 52450fb979
commit 141cfd37c7
2 changed files with 71 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
<?php
// for actual template.
$gradientFor = $_POST['gradientFor'];
// $gradientPrefix = $_POST['gradientPrefix'];
$TrimCcount = $_POST['trimCount'];
$stop_color_1 = $_POST['stop_color_1'];
$stop_color_2 = $_POST['stop_color_2'];
$offset_1 = $_POST['offset_1'];
$offset_2 = $_POST['offset_2'];
if($gradientFor == "Body"){
?>
<linearGradient id="Body_Gradient" gradientUnits="userSpaceOnUse" x1="0%" y1="100%" x2="0%" y2="0%">
<stop id="Body_Gradient_Color2" offset="<?php echo $offset_2 ?>" stop-color="<?php echo $stop_color_2 ?>" />
<stop id="Body_Gradient_Color1" offset="<?php echo $offset_1 ?>" stop-color="<?php echo $stop_color_1 ?>" />
</linearGradient>
<?php
}
if($gradientFor == "Body_Pattern"){
?>
<linearGradient id="Body_Pattern_Gradient" gradientUnits="userSpaceOnUse" x1="0%" y1="100%" x2="0%" y2="0%">
<stop id="Body_Pattern_Gradient_Color2" offset="<?php echo $offset_2 ?>" stop-color="<?php echo $stop_color_2 ?>" />
<stop id="Body_Pattern_Gradient_Color1" offset="<?php echo $offset_1 ?>" stop-color="<?php echo $stop_color_1 ?>" />
</linearGradient>
<?php
}
if($gradientFor == "Trim"){
?>
<linearGradient id="<?php echo 'Trim_'.$TrimCcount.'_Gradient' ; ?>" gradientUnits="userSpaceOnUse" x1="0%" y1="100%" x2="0%" y2="0%">
<stop id="<?php echo 'Trim_'.$TrimCcount.'_Gradient_Color2' ; ?>" offset="<?php echo $offset_2 ?>" stop-color="<?php echo $stop_color_2 ?>" />
<stop id="<?php echo 'Trim_'.$TrimCcount.'_Gradient_Color1' ; ?>" offset="<?php echo $offset_1 ?>" stop-color="<?php echo $stop_color_1 ?>" />
</linearGradient>
<?php
}
if($gradientFor == "Trim_Pattern"){
?>
<linearGradient id="<?php echo 'Trim_'.$TrimCcount.'_Pattern_Gradient' ; ?>" gradientUnits="userSpaceOnUse" x1="0%" y1="100%" x2="0%" y2="0%">
<stop id="<?php echo 'Trim_'.$TrimCcount.'_Pattern_Gradient_Color2' ; ?>" offset="<?php echo $offset_2 ?>" stop-color="<?php echo $stop_color_2 ?>" />
<stop id="<?php echo 'Trim_'.$TrimCcount.'_Pattern_Gradient_Color1' ; ?>" offset="<?php echo $offset_1 ?>" stop-color="<?php echo $stop_color_1 ?>" />
</linearGradient>
<?php
}
?>

View File

@@ -624,6 +624,25 @@
},2000); },2000);
} }
function loadGradientTemplate(gradientFor, gradientIds, gradientColor1, gradientColor2, gradientColorOffset1, gradientColorOffset2, trimCount){
var url = "{{ asset('/assets/gradient-append-2.php') }}";
$.post(url, {
gradientFor : gradientFor,
stop_color_1 : gradientColor1,
stop_color_2 : gradientColor2,
offset_1 : gradientColorOffset1,
offset_2 : gradientColorOffset2,
trimCount : trimCount
})
.done(function( data ) {
var g = document.getElementById(gradientIds);
var prevData = $(g).html();
$(g).html(prevData+data);
});
}
</script> </script>
</body> </body>